#Setting a reasonable p-value threshold to be used throughout

p_cutoff <- 0.05

p_cutoff_new <- 0.05

knitr::opts_chunk$set(echo = FALSE, message = FALSE, warning = FALSE)

FC_cutoff_original <- 0

FC_cutoff_new <- 1

1 Global parameters for modeling

## R version 3.5.2 (2018-12-20)
## Platform: x86_64-apple-darwin15.6.0 (64-bit)
## Running under: macOS High Sierra 10.13.3
## 
## Matrix products: default
## BLAS: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRblas.0.dylib
## LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib
## 
## locale:
## [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
## 
## attached base packages:
## [1] parallel  stats4    stats     graphics  grDevices utils     datasets 
## [8] methods   base     
## 
## other attached packages:
##  [1] vsn_3.50.0                  lattice_0.20-38            
##  [3] gplots_3.0.1.1              edgeR_3.24.3               
##  [5] limma_3.38.3                DESeq2_1.22.2              
##  [7] SummarizedExperiment_1.12.0 DelayedArray_0.8.0         
##  [9] BiocParallel_1.16.6         matrixStats_0.54.0         
## [11] Biobase_2.42.0              GenomicRanges_1.34.0       
## [13] GenomeInfoDb_1.18.2         IRanges_2.16.0             
## [15] S4Vectors_0.20.1            BiocGenerics_0.28.0        
## [17] ggrepel_0.8.0               tidyr_0.8.3                
## [19] dplyr_0.8.0.1               RColorBrewer_1.1-2         
## [21] cowplot_0.9.4               pheatmap_1.0.12            
## [23] gtools_3.8.1                ggplot2_3.1.1              
## [25] MASS_7.3-51.4              
## 
## loaded via a namespace (and not attached):
##  [1] bitops_1.0-6           bit64_0.9-7            tools_3.5.2           
##  [4] backports_1.1.4        affyio_1.52.0          R6_2.4.0              
##  [7] KernSmooth_2.23-15     rpart_4.1-13           Hmisc_4.2-0           
## [10] DBI_1.0.0              lazyeval_0.2.2         colorspace_1.4-1      
## [13] nnet_7.3-12            withr_2.1.2            tidyselect_0.2.5      
## [16] gridExtra_2.3          preprocessCore_1.44.0  bit_1.1-14            
## [19] compiler_3.5.2         htmlTable_1.13.1       caTools_1.17.1.2      
## [22] scales_1.0.0           checkmate_1.9.1        affy_1.60.0           
## [25] genefilter_1.64.0      stringr_1.4.0          digest_0.6.18         
## [28] foreign_0.8-71         rmarkdown_1.12         XVector_0.22.0        
## [31] base64enc_0.1-3        pkgconfig_2.0.2        htmltools_0.3.6       
## [34] htmlwidgets_1.3        rlang_0.3.4            rstudioapi_0.10       
## [37] RSQLite_2.1.1          acepack_1.4.1          RCurl_1.95-4.12       
## [40] magrittr_1.5           GenomeInfoDbData_1.2.0 Formula_1.2-3         
## [43] Matrix_1.2-17          Rcpp_1.0.1             munsell_0.5.0         
## [46] stringi_1.4.3          yaml_2.2.0             zlibbioc_1.28.0       
## [49] plyr_1.8.4             grid_3.5.2             blob_1.1.1            
## [52] gdata_2.18.0           crayon_1.3.4           splines_3.5.2         
## [55] annotate_1.60.1        locfit_1.5-9.1         knitr_1.22            
## [58] pillar_1.3.1           geneplotter_1.60.0     XML_3.98-1.19         
## [61] glue_1.3.1             evaluate_0.13          latticeExtra_0.6-28   
## [64] BiocManager_1.30.4     data.table_1.12.2      gtable_0.3.0          
## [67] purrr_0.3.2            assertthat_0.2.1       xfun_0.6              
## [70] xtable_1.8-3           survival_2.44-1.1      tibble_2.1.1          
## [73] AnnotationDbi_1.44.0   memoise_1.1.0          cluster_2.0.8

Number of raw counts, samples

## [1] 30471   130
## [1]  5 81
## [1] 30466    81
##  [1] "physiologyFW"                           
##  [2] "physiologyM"                            
##  [3] "condition15_ppt"                        
##  [4] "cladeClade2"                            
##  [5] "cladeClade3"                            
##  [6] "physiologyM:condition15_ppt"            
##  [7] "physiologyM:cladeClade2"                
##  [8] "physiologyM:cladeClade3"                
##  [9] "condition15_ppt:cladeClade2"            
## [10] "condition15_ppt:cladeClade3"            
## [11] "physiologyM:condition15_ppt:cladeClade2"
## [12] "physiologyM:condition15_ppt:cladeClade3"
## [1] 12
## attr(,"method")
## [1] "tolNorm2"
## attr(,"useGrad")
## [1] FALSE
## attr(,"tol")
## [1] 1.798561e-14
## [1] 81 12
## [1] "matrix"
## [1] 21401    81

## [1] 0.751381
##  [1] "physiologyFW"                           
##  [2] "physiologyM"                            
##  [3] "condition15_ppt"                        
##  [4] "cladeClade2"                            
##  [5] "cladeClade3"                            
##  [6] "physiologyM:condition15_ppt"            
##  [7] "physiologyM:cladeClade2"                
##  [8] "physiologyM:cladeClade3"                
##  [9] "condition15_ppt:cladeClade2"            
## [10] "condition15_ppt:cladeClade3"            
## [11] "physiologyM:condition15_ppt:cladeClade2"
## [12] "physiologyM:condition15_ppt:cladeClade3"

2 Exploratory Plots

2.1 Heatmaps

2.1.1 Individuals clustered by overall expression

2.1.2 Individuals by Top 100 genes heatmap

2.1.3 Individuals clustered by top 100 gene expression

2.1.4 PCA for overall expression